<template>
	<view class="content">
		<view class="search-block">
			<view class="iconfont" style="color: green;width: 32rpx;height: 32rpx;" @click="search">
				<image src="https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/jq-erq/search.png" style="width: 100%;height: 100%;"></image>
			</view>
			<input placeholder="请输入项目名称" v-model="searchName" class="search-item" @confirm="search"/>
		</view>
		<view class="menu-block block" v-for="item in projectList" :key="item.id" @click="navigate('/page_other/entrepot/project/projectDetail?id='+item.id)">
			<view class="title">
				{{ item.projectName }}
			</view>
			<view class="data">
				{{ item.releaseTime }}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getProjectList
	} from '@/api/entrepot.js';
	export default {
		data() {
			return {
				page: 1,
				limit: 100,
				searchName:'',
				projectList:[]
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			getList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getProjectList({
					page: this.page,
					limit: this.limit,
					projectName: this.searchName,
				}).then(data => {
					uni.hideLoading()
					this.projectList = data.list
				}).catch(() => {
					uni.hideLoading()
				})
			},
			search() {
				this.more = true
				this.getList(true)
			},
		},
		onLoad() {
			this.getList(true)
		}
	}
</script>

<style lang="scss" scoped>
	.block {
		width: $content-width;
	}
	.menu-block {
		margin: 30rpx auto;
		background: #fff;
		border-radius: 12px;
		padding: 30rpx;
		.title{
			font-size: 32rpx;
			line-height: 60rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
		}
		.data{
			color: #767676;
			font-size: 28rpx;
			margin-top: 20rpx;
		}
	}
	
	.search-block {
		width: 92%;
		border: 2px solid #fff;
		color: #000;
		font-size: 28rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 0 20rpx;
		border-radius: 40rpx;
		height: 80rpx;
		// margin-bottom: 30rpx;
		// margin-top: 20rpx;
		margin: 20rpx auto 30rpx;
	
		.iconfont {
			flex-grow: 0;
			font-size: 38rpx;
			font-weight: bold;
			margin-right: 10rpx;
			color: #F4F5F7;
		}
	
		input {
			flex-grow: 1;
		}
	}
</style>